﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ClientLib;


namespace Manager
{
    static class Program
    {
        public static ClientLib.TinyClientRuntime g_runtime = new ClientLib.TinyClientRuntime();
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
             
       

            g_runtime.g_TCPclient = new TinyMsgToolLib.TinyMsgInterface();
            //read config file
            if (!g_runtime.g_Config.readConfig("CCClient.xml"))
                return;
            //end read config file


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginForm lgf = new LoginForm();
            if (lgf.setRemoteAddr(g_runtime.g_Config.m_serverIP, g_runtime.g_Config.m_serverPort) == false)
            {
                MessageBox.Show("配置错误,程序退出！");
                Environment.Exit(0);
                return;
            }
            //lgf.setConfig(m_config);
            lgf.setRuntime(g_runtime);
            lgf.ShowDialog();
            if (lgf.getLoginStatus() == LoginForm.LOGINFORM_LOGINSUCC)
            {
                MainForm main = new MainForm();
                main.setRuntime(g_runtime);
                Application.Run(main);
            }
            else
            {
                MessageBox.Show("登陆错误，程序退出！");
                Environment.Exit(0);
                return;
            }
        
           /* Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());*/
        }
    }
}